package helper;

import play.Play;

/**
 * 全局配置变量.
 */
public class GlobalConfig {

    /**
     * 应用 运行模式： prod / test
     * 默认 prod，但通过配置文件可设置为 test， 之后就可以做各种魔法事
     */
    public final static String APP_MODE = Play.configuration.getProperty("app.mode", "prod");

    public final static String BUILD_ID = Play.configuration.getProperty("build.id", "local" + System.currentTimeMillis());

    /**
     * 超级管理员用户列表，用逗号分隔.
     *
     * 这个列表的用户，可以修改集团下属公司的员工.
     */
    public final static String SUPER_USER_IDS = Play.configuration.getProperty("super.user_ids", "");

    public final static String CONTEXT_PATH = Play.configuration.getProperty("http.path", "/");

    public final static Long MAX_FREE_USERCOUNT = 100L;
    public final static Integer MAX_FREE_ROOMCOUNT = 3;  //REMOVE: 不再使用，使用product中设置的freeCount

    public final static Integer TRIAL_VALID_DAYS = 15;
    public final static Integer TRIAL_MEETING_ROOM_SIZE = 20;

    public static final String  QR_LOGIN_CACHE_KEY = "QrLogin";

    public static final String ANONYMOUS_USER_LOGIN_NAME = "__ANONYMOUS_USER__";

    // Session: 使用旧版本v1界面
    public static final String SESSION_UI_V1 = "ui_v1";

    // Oracle: 这个变量需要手工修改为oracle schema
    // MySQL: 设置为""即可
    public static final String MIGAO_DB_SCHEMA = "";

    public static final String INIT_LOAD_TEST_DATA = Play.configuration.getProperty("init.load-test-data", "false");

    // 用于定制安装版本的常量，在线版不使用
    public static final String CORP_NAME         = Play.configuration.getProperty("corp.name", "开发用测试公司");
    public static final String CORP_ROOM_LIMIT   = Play.configuration.getProperty("corp.room-limit");
    public static final String CORP_EXPIRE_ON    = Play.configuration.getProperty("corp.expire_on");
    public static final String LICENSE_TYPE      = Play.configuration.getProperty("license.type");
    public static final String LICENSE_SIGN      = Play.configuration.getProperty("license.sign");
    public static final String ROOT_CORP_NAME      = Play.configuration.getProperty("corp.root.corpName"); //集团公司名称

    // 功能列表： 不通过license检查，方便添加
    public static final String DEFAULT_FUNC_LIST = Play.configuration.getProperty("default.func");

    // 功能列表：license会检查，所以在私有安装版本，不会读取corp级别的license.func
    public static final String LICENSE_FUNC_LIST = Play.configuration.getProperty("license.func");
    // 用于去掉不应该使用的权限
    public static final String LICENSE_FUNC_REMOVE = Play.configuration.getProperty("license.func.remove");
    // 用于去掉不应该使用的角色
    public static final String LICENSE_ROLES_DISABLED = Play.configuration.getProperty("license.roles.disabled");

    // 微信页面登录方法，如果是password就转到登录页面
    public static final String WAP_LOGIN_METHOD = Play.configuration.getProperty("wap.login.method", "weixin");

    public static String FROM_MAIL = Play.configuration.getProperty("mail.from");

    public static String REDIS_URL = Play.configuration.getProperty("redis.url");

    /**
     * 网站主域名.
     */
    public final static String  APPLICATION_BASE_DOMAIN = Play.configuration.getProperty("application.baseDomain",
            "hyshi.ngrok.bayrand.com");
    public static       boolean APPLICATION_URL_SSL     = Boolean.valueOf(Play.configuration.getProperty("application.url.ssl", "false"));

    /**
     * Assets 图片服务URL.
     * 如: img_server.base.url=http://hys.cdn6.cn
     */
    public final static String IMG_SERVER_BASE_URL = Play.configuration.getProperty("img_server.base.url", "http://hys.cdn6.cn");

    /**
     * 默认公司logo跟踪.
     */
    public final static String CORP_DEFAULT_LOGO_URL = Play.configuration.getProperty(GlobalConfigKeys.CORP_DEFAULT_LOGO_URL, "/u/default-company-logo2.png");

    public final static String BAIDU_API_AK = "9fb983ecd9b505f8fedcc9ab07c65e3e";

    /**
     * Outlook插件的APP ID, 固定不变
     */
    public final static String OUTLOOK_WINDOWS_APP_ID = "outlook4win";

    /**
     * 美洽ID.
     */
    public final static String MEIQIA_ID =  Play.configuration.getProperty("meiqia.id");

    /**
     * 微信Web登录Session Key
     */
    public final static String API_HEADER_SESSION = "x-session";

    public final static String API_HEADER_TOKEN = "token";

    /**
     * 平台类型Header.
     */
    public final static String API_HEADER_PLATFORM = "x-platform";


    /**
     * 设备接口使用的Header名
     */
    public final static String DEVICE_API_NO = "x-hys-device-no";
    public final static String DEVICE_API_SN = "x-hys-device-sn";
    public final static String DEVICE_API_TOKEN = "x-hys-device-token";

    public static final String APP_NAME                   = Play.configuration.getProperty("app.name", "安防管理系统");

    // TODO: react开头的是手机版，需要重构为 MOBILE 开头
    // react cdn 版本
    public final static String MOBILE_REACT_JS_VERSION  =  Play.configuration.getProperty("react.js.version", "e0c7ff84");
    public final static String MOBILE_REACT_CSS_VERSION =  Play.configuration.getProperty("react.css.version", "fbbe16ca");

    public final static String MOBILE_REACT_ASSET_BASE = Play.configuration.getProperty("react.asset.base", "//a.cdn6.cn/mobile-react");
    public final static String MOBILE_REACT_JS_URL     =  Play.configuration.getProperty("react.js.url");
    public final static String MOBILE_REACT_CSS_URL    =  Play.configuration.getProperty("react.css.url");
    // 自定义扩展web资源.
    public final static String MOBILE_CUSTOM_ASSETS       = Play.configuration.getProperty("mobile.custom.assets");


    // Web版本react cdn版本
    public final static String WEB_REACT_JS_VERSION  = Play.configuration.getProperty("web.react.js.version", "");
    public final static String WEB_REACT_CSS_VERSION = Play.configuration.getProperty("web.react.css.version", "");

    public final static String WEB_ASSET_BASE = Play.configuration.getProperty("web.asset.base", "//a.cdn6.cn/web-react");
    public final static String WEB_REACT_JS_URL = Play.configuration.getProperty("web.react.js.url");
    public final static String WEB_REACT_CSS_URL = Play.configuration.getProperty("web.react.css.url");

    // 阿里云 OSS 配置信息
    public final static String ALI_OSS_ENDPOINT = "http://oss-cn-beijing.aliyuncs.com";
    public final static String ALI_OSS_ACCESS_KEY_ID = "dgneRI3o7IJFXSRC";
    public final static String ALI_OSS_ACCESS_KEY_SECRET = "PT74UGnspNnXS3fSUGKjYGPfF42l4l";
    public final static String ALI_OSS_BUCKET_NAME = "tongshitongshi";
    public final static String ALI_OSS_DOMAIN = "http://cdn.buhaoba.com";
    public final static String ALI_IMG_OSS_DOMAIN = "http://tongshitongshi.oss-cn-beijing-internal.aliyuncs.com";
    // CDN配置信息
    public final static String ASSETS_BASE_URL = "http://tongshitongshi.oss-cn-beijing.aliyuncs.com";
    public final static String ASSETS_VERSION = "v1";

    /**
     * 文件上传开关： 上传到OSS或LOCAL
     */
    public static final String FILE_UPLOAD_STORE = Play.configuration.getProperty("file.upload.store", "OSS");

    // =========== 文件上传相关配置 ,上传路径,最大尺寸,文件类型
    public static final String FILE_UPLOAD_ROOT_PATH    = Play.configuration.getProperty("file.upload.root.path", "/tmp/Pictures");
    public static final String IMAGE_GENERATE_ROOT_PATH = Play.configuration.getProperty("image.root.generated", "/tmp/GeneratePictures"); //缩略图根目录

    public static final Integer IMAGE_MAX_SIZE = Integer.parseInt(Play.configuration.getProperty("image.upload.size.max", "10240000"));

    public static final String IMAGE_FILE_TYPES = Play.configuration.getProperty("image.upload.allow.types", "jpg,png,gif,jpeg,bmp");

    // Exchange 配置
    public static String EWS_URL      = Play.configuration.getProperty(GlobalConfigKeys.EWS_URL, "https://owa.sinotrans.com/EWS/Exchange.asmx");
    public static String EWS_USERNAME = Play.configuration.getProperty(GlobalConfigKeys.EWS_USERNAME, "print-test");
    public static String EWS_DOMAIN   = Play.configuration.getProperty(GlobalConfigKeys.EWS_DOMAIN, "center");
    public static String EWS_PASSWORD = Play.configuration.getProperty(GlobalConfigKeys.EWS_PASSWORD, "123%abc");
    public static String EWS_MAIL_POSTFIX = Play.configuration.getProperty(GlobalConfigKeys.EWS_MAIL_POSTFIX, "");
    public static boolean EWS_MOCK_OWNER = "true".equals(Play.configuration.getProperty(GlobalConfigKeys.EWS_MOCK_OWNER, "true"));


    public static String APP_PROXY_HOST = Play.configuration.getProperty("app.proxy.host");
    public static String APP_PROXY_PORT = Play.configuration.getProperty("app.proxy.port");


    // ================================  高德地图 ================================
    public final static String AMAP_WEBAPI_KEY = Play.configuration.getProperty("amap.webapi.key", "56b5b8bcf87df2ba9c96eab9b39b56fd");
    public final static String AMAP_WEBJS_KEY = Play.configuration.getProperty("amap.webjs.key", "f46fb4b48a37966ca7df695416b56869");

    // MOBSET_SMS 广州首易信短信
    public static String MOBSET_SMS_HOST     = Play.configuration.getProperty("mobset.sms.host", "sms.mobset.com");
    public static String MOBSET_SMS_CORPID   = Play.configuration.getProperty("mobset.sms.corp_id");
    public static String MOBSET_SMS_USERNAME = Play.configuration.getProperty("mobset.sms.username");
    public static String MOBSET_SMS_PASSWORD = Play.configuration.getProperty("mobset.sms.password");
    public static String MOBSET_SMS_POSTFIX  = Play.configuration.getProperty("mobset.sms.postfix");

    // SubMail配置
    public static String SUBMAIL_APPID = Play.configuration.getProperty("submail.appId");
    public static String SUBMAIL_APPKEY = Play.configuration.getProperty("submail.signType");

    /**
     * MQTT
     */
    public final static String MQTT_BROKER = Play.configuration.getProperty("mqtt.broker");
    public final static String MQTT_USERNAME = Play.configuration.getProperty("mqtt.username","admin");
    public final static String MQTT_PASSWORD = Play.configuration.getProperty("mqtt.password","public");
    public final static String MQTT_TOPIC = Play.configuration.getProperty("mqtt.topic","hyshidevice");


    /**
     * Sency配置.
     */
    public final static String SENTRY_ID = Play.configuration.getProperty("sentry.id", "235797");
    public final static String SENTRY_CODE = Play.configuration.getProperty("sentry.code", "4085793907b04c7fb1b32ea7212cb20c");

}
